import request from '@/utils/request'

// 获取员工简单列表
export function getEmployeesSimp() {
    return request({
        url: '/sys/user/simple',
        method: 'get'
    })
}

// 获取员工综合列表
export function getEmployeesList(params) {
    return request({
        url: '/sys/user',
        method: 'get',
        params: params
    })
}

// 根据员工 id 删除员工
export function delEmployee(id) {
    return request({
        url: `/sys/user/${id}`,
        method: 'delete'
    })
}

// 新增员工
export function addEmployee(data) {
    return request({
        url: '/sys/user',
        method: 'POST',
        data: data
    })
}

// 批量导入员工
export function addEmployeeBatch(data) {
    return request({
        url: '/sys/user/batch',
        method: 'POST',
        data: data
    })
}

// 获取员工基本信息
export function getEmployeeBasicInfo(id) {
    return request({
      url: `/sys/user/${id}`,
      method: 'get'
    })
}

// 修改员工基本信息
export function updEmployeeBasicInfo(data) {
    return request({
        url: `/sys/user/${data.id}`,
        method: 'PUT',
        data: data
    })
}

// 获取员工个人信息
export function getEmployeePersonalInfo(id) {
    return request({
      url: `/employees/${id}/personalInfo`,
      method: 'get'
    })
}

// 修改员工个人信息
export function updEmployeePersonalInfo(data) {
    return request({
      url: `/employees/${data.userId}/personalInfo`,
      method: 'put',
      data
    })
}

// 获取员工岗位信息
export function getEmployeeJobInfo(id) {
    return request({
      url: `/employees/${id}/jobs`,
      method: 'get'
    })
}

// 更新员工岗位信息
export function updEmployeeJobInfo(data) {
    return request({
      url: `/employees/${data.userId}/jobs`,
      method: 'put',
      data
    })
}

// 给员工分配角色
export function assignRoles(data) {
    return request({
      url: '/sys/user/assignRoles',
      method: 'put',
      data
    })
}

// 下载员工导入模版
export function getExcelTemplate() {
    return request({
      url: '/sys/user/import/template',
      responseType: 'blob',
    })
}